filechoosernativeportal: stuff the current filter into options
authorMichael Catanzaro <mcatanzaro@igalia.com>
Wed, 16 Jan 2019 01:51:00 +0000 (19:51 -0600)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 19 Jan 2019 01:02:11 +0000 (20:02 -0500)
We need to tell the portal what filter is supposed to be selected by
default, or it will just pick the first one, which could be wrong and
annoying.

This will require updated xdg-desktop-portal and xdg-desktop-portal-gtk
to work properly.

Fixes #1492

gtk/gtkfilechoosernativeportal.c

index f3ad20053e0fa8da663cba2824ea89363508a11b..e658d70fcd64eb89df6587e4b01b12a99d14eebe 100644 (file)
@@ -332,6 +332,9 @@ show_portal_file_chooser (GtkFileChooserNative *self,
   g_variant_builder_add (&opt_builder, "{sv}", "modal",
                          g_variant_new_boolean (data->modal));
   g_variant_builder_add (&opt_builder, "{sv}", "filters", get_filters (GTK_FILE_CHOOSER (self)));
+  if (self->current_filter)
+    g_variant_builder_add (&opt_builder, "{sv}", "current_filter",
+                           gtk_file_filter_to_gvariant (self->current_filter));
   if (self->current_name)
     g_variant_builder_add (&opt_builder, "{sv}", "current_name",
                            g_variant_new_string (GTK_FILE_CHOOSER_NATIVE (self)->current_name));